Mapping a boolean[] PostgreSql column with Hibernate

Posted by teabot on Stack Overflow See other posts from Stack Overflow or by teabot
Published on 2010-05-10T14:34:00Z Indexed on 2010/05/11 6:04 UTC
Read the original article Hit count: 369

Filed under:
|
|
|
|

I have a column in a PostgreSql database that is defined with type boolean[]. I wish to map this to a Java entity property using Hibernate 3.3.x. However, I cannot find a suitable Java type that Hibernate is happy to map to. I thought that the java.lang.Boolean[] would be the obvious choice, but Hibernate complains:

Caused by: org.hibernate.HibernateException:
    Wrong column type in schema.table for column mycolumn. Found: _bool, expected: bytea
    at org.hibernate.mapping.Table.validateColumns(Table.java:284)
    at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1130)

I have also tried the following property types without success:

  • java.lang.String
  • java.lang.boolean[]
  • java.lang.Byte[]

How can I map this column?

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate